const idpools = [];
let id = -1;
class ids {
    static generate() {
        if (idpools.length > 0) {
            return idpools.pop();
        } else {
            ++id;
            return id.toString();
        }
    }
    static recovery(id) {
        idpools.push(id);
    }
    static toColor(id) {
        let r = (id >> 16 & 255) / 255;
        let g = (id >> 8 & 255) / 255;
        let b = (id & 255) / 255;
        return new Float32Array([r, g, b]);
    }
    static fromColor(color) {
        color[0] = color[0] * 255
        color[1] = color[1] * 255
        color[2] = color[2] * 255
        let id = ((color[0]) << 16) | ((color[1]) << 8) | (color[2]);
        return id.toString();
    }
}
export { ids }